
<link rel="stylesheet" href="css/actaulity.css" type="text/css" />

<div id="wraper_act">
	<div class="actuality">Actualité</div>
        	<?php
					@$act_id=$_REQUEST["act_id"];
					if($act_id<>"")
					{
						$sql = "SELECT * FROM tbl_activity WHERE act_id='$act_id'";
					    $result = mysql_query($sql);
						$row = mysql_fetch_array($result);	
						$photo=$row["photo"];
						   if($photo!="")
						   {	
           ?>
                <div id="border_act_top">
                    <div id="img_act_top"><img src="admin/actuality/<?php echo $row["photo"];?>" width="130" height="160" /></div>
                    <div id="title_act_top"><?php echo $row["act_title"];?></div>
                    <div style="font-family:Arial, Helvetica, sans-serif;font-size:13px; text-align:justify; padding:20px 10px 10px 10px ; font-weight:normal;"><?php echo $row["message"];?></div>
                </div><!-- end border act -->
            <?php
						   }//end if
						   else
						   {
			?>
            	<div id="border_act_top">
                    <div id="title_no_img_top"><?php echo $row["act_title"];?></div>
                    <div style="font-family:Arial, Helvetica, sans-serif;font-size:13px; text-align:justify; padding:10px 10px 10px 10px ; font-weight:normal;"><?php echo $row["message"];?></div>
            	</div><!-- end border act -->
            <?php	   
						   }//end else
					}// if act_id<>""
			?>
            <?php
					//if($act_id<>"")
					//{
						//include function from cls_pag
					    include('includes/cls_pagination.php');
					   $sql = "SELECT * FROM tbl_activity ";
					   $result = mysql_query($sql);
					    $Num_Rows = mysql_num_rows($result);
							
									$Per_Page = 4;   // Per Page
									
									@$Page = $_GET["Page"];
									if(!@$Page)
									{
										$Page=1;
									}
									
									$Prev_Page = $Page-1;
									$Next_Page = $Page+1;
									
									$Page_Start = (($Per_Page*$Page)-$Per_Page);
									if($Num_Rows<=$Per_Page)
									{
										$Num_Pages =1;
									}
									else if(($Num_Rows % $Per_Page)==0)
									{
										$Num_Pages =($Num_Rows/$Per_Page) ;
									}
									else
									{
										$Num_Pages =($Num_Rows/$Per_Page)+1;
										$Num_Pages = (int)$Num_Pages;
									}
									
					   $sql .=" ORDER BY act_id DESC LIMIT $Page_Start , $Per_Page";
					   $result  = mysql_query($sql);
					   while($row = mysql_fetch_array($result))
					   {
						   $message=$row["message"];
						   $message=substr($message,0,250);
						   $photo=$row["photo"];
						   if($photo!="")
						   {	
           ?>
                <div id="border_act">
                    <div id="img_act"><a href="index.php?page=actaulity&act_id=<?php echo $row["act_id"];?>" ><img src="admin/actuality/<?php echo $row["photo"];?>" width="130" height="160" /></a></div>
                    <div id="title_act"><?php echo $row["act_title"];?></div>
                    <div id="comment_act">
					<?php echo $message;?>
                    <a href="index.php?page=actaulity&act_id=<?php echo $row["act_id"];?>" 
                    style="font-family:Verdana, Geneva, sans-serif; font-size:14px; color:#c22b30; 
                    text-decoration:none; ">
                    	Lire
                    </a>
                    </div>
                </div><!-- end border act -->
            
            <?php
						   }//end if
						   else
						   {
			?>
            	<div id="border_act">
                    <div id="title_no_img"><?php echo $row["act_title"];?></div>
                    <div id="comment_no_img"><?php echo $message;?>
                        <a href="index.php?page=actaulity&act_id=<?php echo $row["act_id"];?>" 
                        style="font-family:Verdana, Geneva, sans-serif; font-size:14px; color:#c22b30; 
                        text-decoration:none; ">
                            Lire
                        </a>
                   </div>
            	</div><!-- end border act -->
            
            <?php
							   
						   }//end else
					   }//end while
            ?>
            <?php
								if($Num_Rows>4)
				{
								echo "<div id='record_paginate_act'>";
												
									$pages = new Paginator;
									$pages->items_total = $Num_Rows;
									$pages->mid_range = 4;
									$pages->current_page = $Page;
									$pages->default_ipp = $Per_Page;
									$pages->url_next ="index.php?page=actaulity&QueryString=value&Page=";
									$pages->paginate();
														
									echo $pages->display_pages();
													
								echo " </div>" ;
			    }//end check number of product
			//}//end if act_id=""
			?>
</div>